package dk.aiszone.lang.sql;

import dk.aiszone.lang.sql.interfaces.SQLConstraint;

/**
 * Representation of the <i>or</i> operator in SQL.
 * 
 * @author Ais
 */
public class SQLOr extends SQLList {

    /**
     * Constructor for the <code>SQLOr</code> object.
     * 
     * @param arg1
     *            The first <code>SQLConstraint</code> part of the <code>SQLOr</code>.
     */
    public SQLOr(SQLConstraint arg1) {
        super(arg1);
    }

    /**
     * Add a <code>SQLConstraint</code> to the <code>SQLOr</code> statement.
     * 
     * @param constraint
     *            The constraint to add.
     */
    public void addConstraint(SQLConstraint constraint) {
        setConstraint2(new SQLAnd(constraint));
    }

    /**
     * Add another <code>SQLOr</code> to the <code>SQLOr</code> statement.
     * 
     * @param constraint
     *            The <code>SQLOr</code> to add.
     */
    public void addConstraint(SQLOr constraint) {
        setConstraint2(constraint);
    }

    @Override
    protected String getPostFix() {
        return "))";
    }

    @Override
    protected String getPrefix() {
        return "((";
    }

    @Override
    protected String getSeperator() {
        return ") OR (";
    }
}